<?php
/**
 * Created by PhpStorm
 * User: shen.zk
 * Date: 2023/10/25
 * Time: 16:44
 * Comment: ''
 */

namespace App\Models;

class SpecialOrder extends BaseModel
{
    protected $table = 'special_order';

    protected $primaryKey = 'id';

    protected $casts = [
        "create_time" => "datetime",
//        "paytime" => "datetime",
    ];

    public function customer(): \Illuminate\Database\Eloquent\Relations\BelongsTo
    {
        return $this->belongsTo(User::class, 'uid');
    }

    public function getPaytimeAttribute($val)
    {
        if($val > 0) {
            return date("Y-m-d H:i:s",$val);
        }
        return "";
    }

//    public function getPayTypeAttribute($val): string
//    {
//        if ($val == "sandpay") {
//            return "杉德宝快捷支付";
//        } elseif ($val == "sandbao") {
//            return "杉德宝";
//        } elseif ($val == "sandbao_enterprise") {
//            return "企业杉德宝";
//        } else {
//            return "";
//        }
//    }

}
